(function(angular) {
	'use strict';
	angular.module("fs.waf").factory("prodSubtypeService", prodSubtypeService);
	prodSubtypeService.$inject = [ '$q', 'loggerFactory','commonService', 'ajaxServiceFactory' ];
	function prodSubtypeService($q, loggerFactory, commonService, ajaxServiceFactory) {
		var log = loggerFactory.getLogger("prodSubtypeService");
		var ajaxService = ajaxServiceFactory.buildAjaxService({
			getYesNoOptions : {
				url : 'do/cda/dataList/yesno',
				method : 'get'
			}
		});
		
		function getYesNoOptions() {
			var defer = $q.defer();
			ajaxService.getYesNoOptions().then(function(response) {
				defer.resolve(response ? response : {});
			});
			return defer.promise;
		};
		
		function initOptionForSearch(ctrl){
			getYesNoOptions().then(function(response) {
				response.hasEmptyOption = true;
				ctrl.directIssueFlagOptions = response.data;
				ctrl.intOnlyOptions = angular.copy(response.data);
				ctrl.amdOptions = angular.copy(response.data);
				ctrl.addPrincOptions = angular.copy(response.data);
			}, angular.noop);
			
		};
		
		return {
			initOptionForSearch : initOptionForSearch
			
		};
	}
})(angular);